<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <span>修改商品</span>
      <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
    </div>
    <FormBase :config="config" :value="data" />
  </el-card>
</template>
<script type="text/javascript">
import FormBase from '@/components/FormBase'
import fixConfig from './fix_config.js'
import { get_goods_one } from '@/api/goods'
//通过命名空间的方式映入
import { createNamespacedHelpers } from 'vuex'
//获取需要管理的方法
const { mapState, mapActions, mapMutations } = createNamespacedHelpers('multifunction')
export default {
  props: {
    value: [Array, Object]
  },
  components: {
    FormBase
  },
  data() {
    return {
        config:fixConfig,
        data:{},
    }
  },
  /**
   * 计算属性
   * @type {Object}
   */
  computed: {

  },
  /**
   * 数据监听
   * @type {Object}
   */
  watch: {

  },
  created(){
    this.setURL({
      action:'on_goods_edit',
      model:'goods'
    })
  },
  /**
   * 页面加载执行
   * @return {[type]} [description]
   */
  mounted() {
    var data = {};
    if(this.$route.query){
      data = this.$route.query
    }
    get_goods_one(data).then(response => {
      if(response.constructor  == Object || (response.constructor == Array && response.length > 0)){
          this.data =  response;
      }
      console.log('获取结果',response);
    })
  },
  /**
   * 页面方法
   * @type {Object}
   */
  methods: {
      ...mapMutations(['setURL']), 
  }
}

</script>
<style type="text/css" lang="scss">
.box-card {
  margin: 20px;
}

</style>
